package com.xiaojun.whut.Controller.App;

import com.xiaojun.whut.Entity.CardMessage;
import com.xiaojun.whut.Entity.Comment;
import com.xiaojun.whut.Service.CardService;
import com.xiaojun.whut.Service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(path = "/app/comment/")
public class AppCommentController {
    @Autowired
    private CommentService commentService;

    @PostMapping(path = "save")
    public Object saveComment(@RequestBody Comment comment){
        System.out.println(comment.toString());
        return commentService.save(comment);
    }
    @GetMapping(path = "all/{cardMessageId}")
    public Object getAllComment(@PathVariable int cardMessageId){
        return commentService.getAllbyCardMessageId(cardMessageId);
    }
}
